#ifndef _MATHEX_H
#define _MATHEX_H

#include "WEExternal.h"

namespace WuguiEngine
{
	namespace Math
	{
		const float PI = 3.14159275358f;

		class MathEx
		{
		public:
			static float Radian2Degree(float rad)
			{
				return rad / PI * 180.0f;
			}

			static float Degree2Radian(float deg)
			{
				return deg / 180.0f * PI;
			}

			static D3DXVECTOR3* GetMatrixFront(D3DXVECTOR3* pV, const D3DXMATRIX& m)
			{
				pV->x = m.m[2][0];
				pV->y = m.m[2][1];
				pV->z = m.m[2][2];
				return pV;
			}

			static D3DXVECTOR3* GetMatrixUp(D3DXVECTOR3* pV, const D3DXMATRIX& m)
			{
				pV->x = m.m[1][0];
				pV->y = m.m[1][1];
				pV->z = m.m[1][2];
				return pV;
			}

			static D3DXVECTOR3* GetMatrixRight(D3DXVECTOR3* pV, const D3DXMATRIX& m)
			{
				pV->x = m.m[0][0];
				pV->y = m.m[0][1];
				pV->z = m.m[0][2];
				return pV;
			}
		};
	
	}
}

#endif